package com.example.store2024.service.impl;

import com.example.store2024.dao.GoodDao;
import com.example.store2024.model.Good;
import com.example.store2024.service.GoodService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Objects;

@Service
public class GoodServiceImpl implements GoodService {
    private GoodDao goodDao;
    @Autowired
    public void setGoodDao(GoodDao goodDao){
        this.goodDao = goodDao;
    }
    @Override
    public List<Good> findAll(Good search) {
        return this.goodDao.findAll(search);
    }

    @Override
    public Good findGoodById(Integer id) {
        Objects.requireNonNull(id);
        return this.goodDao.findGoodById(id);
    }
}
